home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_script6.asp < prev    next >
Encoding:
Text File  |  1999-07-29  |  1.7 KB  |  49 lines

  1. <form method="Post" Action="iiatmd2.asp#select">
  2.     <input type="hidden" name="ShowData" value="True"><p align="center"><input type="Submit" Value="Show Me"></p>
  3. </form>
  4.  
  5. <% If Request.Form("ShowData") = "True" then
  6. 'Find the physical path for the file in the current directory. 
  7. strDBVirtualPath = "/iishelp/iis/htm/tutorial/EECustmr.mdb"
  8. strDBLocation = Server.Mappath(strDBVirtualPath)
  9.  
  10. 'Define OLE-DB connection string.
  11. 'strSource = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & strDBLocation
  12.  
  13. 'Define ODBC connection string
  14. strSource = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & strDBLocation
  15.  
  16. %>
  17.  
  18.  
  19.  
  20. <%
  21. 'Instantiate ADO Connection Object and open a connection
  22. Set dbConnection = Server.CreateObject("ADODB.Connection")
  23. dbConnection.Open strSource
  24.  
  25. 'Define SQL Query and execute ADO Recordset query
  26. SQLQuery = "SELECT * FROM Customers"
  27. Set rsCustomerList = dbConnection.Execute(SQLQuery)
  28. %>
  29.  
  30. <Center>
  31. <TABLE BORDER=1>
  32. <% Do While Not rsCustomerList.EOF %>
  33. <TR><TD width=105><% = rsCustomerList("ContactFirstName")  %></TD><TD width=105><%= rsCustomerList("ContactLastName") %></TD><TD width=110><% = rsCustomerList("City") %></TD><TD width=27><% = rsCustomerList("StateOrProvince") %></TD></TR>
  34. <%   rsCustomerList.MoveNext 
  35.    Loop %>
  36. </TABLE>
  37. </Center>
  38. <% Else %>
  39. <Center>
  40. <TABLE BORDER=1>
  41. <TR><TD width=105> </TD><TD width=105> </TD><TD width=110> </TD><TD width=27><BR></TD></TR>
  42. <TR><TD width=105> </TD><TD width=105> </TD><TD width=110> </TD><TD width=27><BR></TD></TR>
  43. <TR><TD width=105> </TD><TD width=105> </TD><TD width=110> </TD><TD width=27><BR></TD></TR>
  44. </Table>
  45. </Center>
  46. <%End if%>
  47.  
  48.  
  49.